package com.qubuyer.business.home.adapter

import com.qubuyer.R
import com.qubuyer.databinding.ItemHomeSpecialGoodInfoBinding
import com.qubuyer.repository.entitys.HomeGoodEntity
import com.qubyer.widget.adapter.BindingRvAdapter

/**
 * @author Susong
 * @date 创建时间:2019/6/4
 * @description 首页推荐adapter
 * & @version
 */
class HomeSpecialAdapter(dataList: ArrayList<HomeGoodEntity>, private val onItemCLick: (() -> Unit)? = null) : BindingRvAdapter<HomeGoodEntity, ItemHomeSpecialGoodInfoBinding>(dataList) {

    override fun getItemCount(): Int {
        return super.getItemCount().coerceAtMost(2)
    }

    override val itemLayout: Int
        get() = R.layout.item_home_special_good_info

    override fun onBind(data: HomeGoodEntity, dataBinding: ItemHomeSpecialGoodInfoBinding) {
        dataBinding.data = data
        //NavigationUtil.overlay(mContext, GoodDetailActivity.class, entity.getGoods_id());
        dataBinding.root.setOnClickListener { onItemCLick?.invoke() }
    }
}